import org.apache.commons.lang3.*;
import java.util.*;


public class Lists {

	public ArrayList<String> aList(int size) {

		ArrayList<String> aL = new ArrayList<String>();
		for (int i = 0; i < size; i++)
			aL.add(RandomStringUtils.random(10, "abcdefghijklmnopqrstuvwxyz"));

		return aL;

	}
	
	public LinkedList<String> lList(int size) {

		LinkedList<String> lL = new LinkedList<String>();
		for (int i = 0; i < size; i++)
			lL.add(RandomStringUtils.random(10, "abcdefghijklmnopqrstuvwxyz"));

		return lL;

	}

	public String ranStr() {

		return RandomStringUtils.random(10, "abcdefghijklmnopqrstuvwxyz");
	}

	public long benchLinkedList() {

		long start = System.currentTimeMillis();
		aList(100000);
		long end = System.currentTimeMillis();

		return end - start;
	}

	public long benchArrayList() {

		long start = System.currentTimeMillis();
		lList(100000);
		long end = System.currentTimeMillis();

		return end - start;
	}

	public static void main(String[] args) {

		Lists l = new Lists();
		System.out.println("Time taken for ArrayList : "+l.benchArrayList());
		System.out.println("Time taken for LinkedList:  "+l.benchArrayList());
		}

}
